package com.api.shopapi.mapper;
import com.api.shopapi.entity.BusinessBank;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface BusinessBankMapper {

  @Insert("insert into business_bank (" +
     "BusinessBankCode," +
     "BusinessCode," +
     "BankName," +
     "BankBranch," +
     "BankNumber," +
     "CreateTime," +
     "Status" +
       ")  values ( " +
     "#{businessBank.BusinessBankCode}," +
     "#{businessBank.BusinessCode}," +
     "#{businessBank.BankName}," +
     "#{businessBank.BankBranch}," +
     "#{businessBank.BankNumber}," +
     "#{businessBank.CreateTime}," +
     "#{businessBank.Status}" +
   ")")
  int insert(@Param("businessBank")BusinessBank businessBank);


   @Update("update business_bank set " +
     "BusinessCode=#{businessBank.BusinessCode}," +
     "BankName=#{businessBank.BankName}," +
     "BankBranch=#{businessBank.BankBranch}," +
     "BankNumber=#{businessBank.BankNumber}," +
     "CreateTime=#{businessBank.CreateTime}," +
     "Status=#{businessBank.Status}" +
       " where  BusinessBankCode=#{businessBank.BusinessBankCode}")
  int update(@Param("businessBank")BusinessBank businessBank);

   @Select("select * from business_bank where  BusinessBankCode=#{businessBankCode} limit 1")
   BusinessBank getByBusinessBankCode(@Param("businessBankCode")String businessBankCode);

   @Select("select * from business_bank where  BusinessCode=#{businessCode} limit 1")
   BusinessBank getByBusinessCode(@Param("businessCode")String businessCode);
}
